package com.one.controller;


import com.one.bo.SelectUserBo;
import com.one.bo.UserBo;
import com.one.bo.UserLoginBo;
import com.one.entity.SysUserEntity;
import com.one.service.SysUserService;
import com.one.dto.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author zwj
 * @since 2021-09-08
 */
@RestController
@RequestMapping("/user")
public class SysUserController {
    private final SysUserService sysUserService;

    public SysUserController(SysUserService sysUserService) {
        this.sysUserService = sysUserService;
    }
    @ApiOperation(value = "登录", notes = "登录")
    @PostMapping("/login")
    public Result login(@RequestBody UserLoginBo userLoginBo) {
        return sysUserService.login(userLoginBo);
    }

    @ApiOperation(value = "条件查询用户", notes = "条件查询用户")
    @PostMapping("/selectUser")
    public Result selectUser(@RequestBody SelectUserBo selectUserBo) {
        return sysUserService.selectUser(selectUserBo);
    }
    @ApiOperation(value = "修改用户状态", notes = "修改用户状态")
    @PostMapping("/updateUserStatus")
    public Result updateUserStatus(@RequestBody UserBo userBo) {
        return sysUserService.updateUserStatus(userBo);
    }
    @ApiOperation(value = "删除用户", notes = "删除用户")
    @PostMapping("/deleteUser")
    public Result deleteUser(@RequestBody UserBo userBo) {
        return sysUserService.deleteUser(userBo);
    }
    @ApiOperation(value = "添加用户", notes = "添加用户")
    @PostMapping("/addUser")
    public Result addUser(@RequestBody SysUserEntity sysUserEntity) {
        return sysUserService.addUser(sysUserEntity);
    }
    @ApiOperation(value = "修改用户信息", notes = "修改用户信息")
    @PostMapping("/updateUser")
    public Result updateUser(@RequestBody SysUserEntity sysUserEntity) {
        return sysUserService.updateUser(sysUserEntity);
    }
}

